/** @file               sw_compress.h
 *  @copyright          Copyright (C) 2006-2026 flyfish (tenggui_fu@126.com)
 *  @brief              This file is part of the swallow library
 *  @author             $Author: flyfish $
 *  @version            $Rev: 385 $
 *  @date               $Date: 2016-12-22 00:12:05 +0800 (周四, 22 12月 2016) $
 */
#ifndef __SW_COMPRESS_H__
#define __SW_COMPRESS_H__

#ifdef __cplusplus
extern "C" {
#endif

#define SW_COMPRESS_LEVEL_MIN               0
#define SW_COMPRESS_LEVEL_MAX               9
#define SW_COMPRESS_LEVEL_MID               5

typedef SW_RET (*SW_COMPRESS_PROGRESS_PROC)(const SW_CHAR *pSrcFileName, const SW_CHAR *pDstFileName, SW_UINT32 currentLen, SW_UINT32 totalLen, SW_VOID *pArg);

SW_API SW_RET SW_InitCompressAPI(SW_VOID);
SW_API SW_RET SW_RunCompressAPI(SW_VOID);
SW_API SW_RET SW_StopCompressAPI(SW_VOID);
SW_API SW_RET SW_ExitCompressAPI(SW_VOID);
SW_API SW_RET SW_Compress(SW_VOID *pDstBuf, SW_UINT32 *pDstBufLen, const SW_VOID *pSrcBuf, SW_UINT32 srcBufLen, SW_UINT32 level);
SW_API SW_RET SW_Uncompress(SW_VOID *pDstBuf, SW_UINT32 *pDstBufLen, const SW_VOID *pSrcBuf, SW_UINT32 srcBufLen);
SW_API SW_UINT32 SW_GetUncompressBufLen(const SW_VOID *pBuf, SW_UINT32 bufLen);
SW_API SW_BOOL SW_IsCompressBuf(const SW_VOID *pBuf, SW_UINT32 bufLen);
SW_API SW_BOOL SW_IsCompressFile(const SW_CHAR *pFileName);
SW_API SW_RET SW_CompressFile(const SW_CHAR *pSrcFileName, const SW_CHAR *pDstFileName, SW_UINT32 level, SW_COMPRESS_PROGRESS_PROC progressProc, SW_VOID *pArg);
SW_API SW_RET SW_UncompressFile(const SW_CHAR *pSrcFileName, const SW_CHAR *pDstFileName, SW_COMPRESS_PROGRESS_PROC progressProc, SW_VOID *pArg);
#ifndef SW_V_DISABLE_CMDSERVER
SW_API SW_RET SW_CmdCompressFile(const SW_CHAR *pSrcFileName, const SW_CHAR *pDstFileName, SW_UINT32 level);
SW_API SW_RET SW_CmdUncompressFile(const SW_CHAR *pSrcFileName, const SW_CHAR *pDstFileName);
#endif

#ifdef __cplusplus
}
#endif

#endif

